﻿function initialImgEdit(id) {
    $.ajax({
        url: "/Image/GetImage",
        type: 'GET',
        dataType: 'json',
        contentType: 'application/json; charset=utf-8',
        data: { id: id
        },
        success: function (result) {
            var $ul = $('<ul class="t-upload-files t-reset"></ul>');
            $ul.appendTo($('div.t-upload'));
            $('<li class="t-file"><span class="t-icon"></span><span title="' + result.ImageUrl + '" class="t-filename">' + result.ImageUrl + '</span><button class="t-button t-button-icontext t-upload-action" type="button"><span class="t-icon t-delete"></span>Remove</button></li>')
            .appendTo($ul);
        }
    });
}

function imgSelected(e) {

}

function resetApplyInput() {
    $('input:text').height('16px');
    $('#reset').click(function () {
        $('input').val("");
        $('textarea').val("");
        $('select').each(function(){
            $(this).children('option').first().attr('selected', 'selected');
        });
    });
   
}



function viewImgs(wrapperid, imagearray, imgviewdivtoggler, width, height) {
    var array = JSON.parse(imagearray);
    var mygallery2 = new fadeSlideShow({
        wrapperid: wrapperid, //ID of blank DIV on page to house Slideshow
        dimensions: [width, height], //width/height of gallery in pixels. Should reflect dimensions of largest image
        imagearray: array,
        displaymode: { type: 'auto', pause: 2500, cycles: 0, wraparound: true },
        persist: false, //remember last viewed slide and recall within same session?
        fadeduration: 500, //transition duration (milliseconds)
        descreveal: "always",
        togglerid: imgviewdivtoggler
    })

    var div = $('#imgviewdiv');
    var imgs = $("#" + wrapperid).find('img');

}

function bindingError(e) {
    e.preventDefault();
}